package com.yunhe.common.constant;

import java.util.Objects;

/**
 * 设备常量定义
 * @author liuronglei
 */
public class DeviceConsts {
    // 光储电站代码前缀
    private static final String OPTICAL_STORAGE_PREFIX = "9999";

    public static final String serialSeparator = "-";
    // 设备类型定义
    public enum DEVICE_TYPE {
        Station("Station", "电站"), // 作为一类特殊的设备类型
        Device("Device", "设备"), // 作为设备总类型
        EnergyUnit("EnergyUnit", "能量单元"), // 作为一类特殊的设备类型
        Cell("Cell", "单体"),
        Pack("Pack", "电池包"),
        BatteryCluster("BatteryCluster", "电池簇/组/串"),
        BatteryUnit("BatteryUnit", "电池单元"),
        Storage("Storage", "储能"),
        StorageBox("StorageBox", "储能箱"),
        ChargingPile("ChargingPile", "充电桩"),
        ThermalPower("ThermalPower", "火电机组"),
        PowerTransformer("PowerTransformer", "变压器"),
        SolarTransformer("SolarTransformer", "光伏变压器"),
        DoubleWindingTransformer("DoubleWindingTransformer", "双绕组变压器"),
        ThreeWindingTransformer("ThreeWindingTransformer", "三绕组变压器"),
        TransformerWinding("TransformerWinding", "变压器绕组"),
        RectifierInverter("PCS", "PCS"),
        Inverter("Inverter", "逆变器"),
        Combiner("Combiner", "汇流箱"),
        MeteoStation("MeteoStation", "气象站"),
        Breaker("Breaker", "开关"),
        GatewayBreaker("GatewayBreaker", "关口开关"),
        SolarStorage("SolarStorage", "光储一体机"),
        OtherDevice("OtherDevice", "其它设备"),
        HybridInverter("HybridInverter", "混合逆变器"),
        Stack("Stack", "电堆"),
        RFBUnit("RFBUnit", "液流单元");
        private String value;
        private String title;

        DEVICE_TYPE(String value, String title) {
            this.value = value;
            this.title = title;
        }

        public String value() {
            return value;
        }

        public static DEVICE_TYPE byValue(String value) {
            DEVICE_TYPE[] values = DEVICE_TYPE.values();
            for (DEVICE_TYPE device_type : values) {
                if (Objects.equals(value, device_type.value)) {
                    return device_type;
                }
            }
            return null;
        }

        public String title() {
            return title;
        }
        public boolean equals(String value) {
            return this.value().equals(value);
        }
    }

    // 点号数据类型定义
    public enum POINT_DATA_TYPE {
        /**************** 基础点号数据类型-开始 ****************/
        ActivePower("ActivePower", "有功功率"),
        Temperature("Temperature", "温度"),
        Resistance("Resistance", "内阻"),
        Frequency("Frequency", "频率"),
        PowerFactor("PowerFactor", "功率因数"),
        Voltage("Voltage", "电压"),
        A_VOLTAGE_TYPE_NAME("A_PhaseVoltage", "A相电压"),
        B_VOLTAGE_TYPE_NAME("B_PhaseVoltage", "B相电压"),
        C_VOLTAGE_TYPE_NAME("C_PhaseVoltage", "C相电压"),
        Current("Current", "电流"),
        A_CURRENT_TYPE_NAME("A_PhaseCurrent", "A相电流"),
        B_CURRENT_TYPE_NAME("B_PhaseCurrent", "B相电流"),
        C_CURRENT_TYPE_NAME("C_PhaseCurrent", "C相电流"),
        WORK_STATUS("WorkStatus", "运行状态"),
        GRID_CONNECT_STATUS("GridConnectStatus", "并网状态"),
        HEALTH_STATUS("HealthStatus", "健康状态"),
        BREAKER_STATUS("BreakerStatus", "开关状态"),
        HEART_BEAT("HeartBeat", "通讯中断"),
        Faulty("Faulty", "故障"),
        Inactive("Inactive", "停机"),
        UNBALANCE_VOLTAGE_NAME("UnbalanceVoltage", "电压不平衡度"),
        UNBALANCE_CURRENT_NAME("UnbalanceCurrent", "电流不平衡度"),
        REAL_TIME_PRICE_PDT("RealTimePrice", "实时电价"),
        /**************** 基础点号数据类型-结束 ****************/

        PowerSharp("PowerSharp", "当前尖峰电度"),
        PowerPeak("PowerSharp", "当前峰电度"),
        PowerFlat("PowerFlat", "当前平电度"),
        PowerValley("PowerValley", "当前谷电度"),
        PowerAll("PowerAll", "正向有功总电度"),

        /**************** 电量和收益相关点号数据类型-开始 ****************/
        // 充电量
        Charge("Charge", "充电量"),
        ChargeDetail("ChargeDetail", "15min充电量"),
        ChargeDay("ChargeDay", "日充电量"),
        ChargeDayMeas("ChargeDayMeas", "日充电量（实际量测值）"),
        ChargeMonth("ChargeMonth", "月充电量"),
        ChargeYear("ChargeYear", "年充电量"),
        ChargeAmount("ChargeAmount", "累计充电量"),
        ValleyCharge("ValleyCharge", "低谷充电量"),
        FlatCharge("FlatCharge", "平段充电量"),
        PeakCharge("PeakCharge", "高峰充电量"),
        SharpCharge("SharpCharge", "尖峰充电量"),

        // 放电量
        Discharge("Discharge", "放电量"),
        DischargeDetail("DischargeDetail", "15min放电量"),
        DischargeDay("DischargeDay", "日放电量"),
        DischargeDayMeas("DischargeDayMeas", "日放电量（实际量测值）"),
        DischargeMonth("DischargeMonth", "月放电量"),
        DischargeYear("DischargeYear", "年放电量"),
        DischargeAmount("DischargeAmount", "累计放电量"),
        ValleyDischarge("ValleyDischarge", "低谷放电量"),
        FlatDischarge("FlatDischarge", "平段放电量"),
        PeakDischarge("PeakDischarge", "高峰放电量"),
        SharpDischarge("SharpDischarge", "尖峰放电量"),

        // 电能示数
        ChargeMeterIndication("ChargeMeterIndication", "正向电能示数"),
        DischargeMeterIndication("DischargeMeterIndication", "反向电能示数"),

        // 收益
        Profit("Profit", "收益"),
        ProfitDetail("ProfitDetail", "15min收益"),
        ProfitDay("ProfitDay", "日收益"),
        ProfitMonth("ProfitMonth", "月收益"),
        ProfitYear("ProfitYear", "年收益"),
        ProfitAmount("ProfitAmount", "累计收益"),

        // 光伏收益
        SolarProfit("SolarProfit", "光伏收益"),
        SolarProfitDetail("SolarProfitDetail", "光伏15min收益"),
        SolarProfitDay("SolarProfitDay", "光伏日收益"),
        SolarProfitMonth("SolarProfitMonth", "光伏月收益"),
        SolarProfitYear("SolarProfitYear", "光伏年收益"),
        SolarProfitAmount("SolarProfitAmount", "光伏累计收益"),
        // 光伏收益
        SolarProfitIgnoreSelfUse("SolarProfitIgnoreSelfUse", "光伏收益（不计自发自用）"),
        SolarProfitIgnoreSelfUseDetail("SolarProfitIgnoreSelfUseDetail", "光伏15min收益（不计自发自用）"),
        SolarProfitIgnoreSelfUseDay("SolarProfitIgnoreSelfUseDay", "光伏日收益（不计自发自用）"),
        SolarProfitIgnoreSelfUseMonth("SolarProfitIgnoreSelfUseMonth", "光伏月收益（不计自发自用）"),
        SolarProfitIgnoreSelfUseYear("SolarProfitIgnoreSelfUseYear", "光伏年收益（不计自发自用）"),
        SolarProfitIgnoreSelfUseAmount("SolarProfitIgnoreSelfUseAmount", "光伏累计收益（不计自发自用）"),
        // 储能收益
        StorageProfit("StorageProfit", "储能收益"),
        StorageProfitDetail("StorageProfitDetail", "储能15min收益"),
        StorageProfitDay("StorageProfitDay", "储能日收益"),
        StorageProfitMonth("StorageProfitMonth", "储能月收益"),
        StorageProfitYear("StorageProfitYear", "储能年收益"),
        StorageProfitAmount("StorageProfitAmount", "储能累计收益"),
        // 储能收益
        StorageProfitIgnoreSelfUse("StorageProfitIgnoreSelfUse", "储能收益（不计自发自用）"),
        StorageProfitIgnoreSelfUseDetail("StorageProfitIgnoreSelfUseDetail", "储能15min收益（不计自发自用）"),
        StorageProfitIgnoreSelfUseDay("StorageProfitIgnoreSelfUseDay", "储能日收益（不计自发自用）"),
        StorageProfitIgnoreSelfUseMonth("StorageProfitIgnoreSelfUseMonth", "储能月收益（不计自发自用）"),
        StorageProfitIgnoreSelfUseYear("StorageProfitIgnoreSelfUseYear", "储能年收益（不计自发自用）"),
        StorageProfitIgnoreSelfUseAmount("StorageProfitIgnoreSelfUseAmount", "储能累计收益（不计自发自用）"),
        // 用能收益
        LoadProfit("LoadProfit", "用能收益"),
        LoadProfitDetail("LoadProfitDetail", "用能15min收益"),
        LoadProfitDay("LoadProfitDay", "用能日收益"),
        LoadProfitMonth("LoadProfitMonth", "用能月收益"),
        LoadProfitYear("LoadProfitYear", "用能年收益"),
        LoadProfitAmount("LoadProfitAmount", "用能累计收益"),
        // 用能收益
        LoadProfitIgnoreSelfUse("LoadProfitIgnoreSelfUse", "用能收益（不计自发自用）"),
        LoadProfitIgnoreSelfUseDetail("LoadProfitIgnoreSelfUseDetail", "用能15min收益（不计自发自用）"),
        LoadProfitIgnoreSelfUseDay("LoadProfitIgnoreSelfUseDay", "用能日收益（不计自发自用）"),
        LoadProfitIgnoreSelfUseMonth("LoadProfitIgnoreSelfUseMonth", "用能月收益（不计自发自用）"),
        LoadProfitIgnoreSelfUseYear("LoadProfitIgnoreSelfUseYear", "用能年收益（不计自发自用）"),
        LoadProfitIgnoreSelfUseAmount("LoadProfitIgnoreSelfUseAmount", "用能累计收益（不计自发自用）"),
        // 发电收益
        GenerationProfit("GenerationProfit", "发电收益"),
        GenerationProfitDetail("GenerationProfitDetail", "1发电5min收益"),
        GenerationProfitDay("GenerationProfitDay", "发电日收益"),
        GenerationProfitMonth("GenerationProfitMonth", "发电月收益"),
        GenerationProfitYear("GenerationProfitYear", "发电年收益"),
        GenerationProfitAmount("GenerationProfitAmount", "发电累计收益"),
        // 发电收益
        GenerationProfitIgnoreSelfUse("GenerationProfitIgnoreSelfUse", "发电收益（不计自发自用）"),
        GenerationProfitIgnoreSelfUseDetail("GenerationProfitIgnoreSelfUseDetail", "发电15min收益（不计自发自用）"),
        GenerationProfitIgnoreSelfUseDay("GenerationProfitIgnoreSelfUseDay", "发电日收益（不计自发自用）"),
        GenerationProfitIgnoreSelfUseMonth("GenerationProfitIgnoreSelfUseMonth", "发电月收益（不计自发自用）"),
        GenerationProfitIgnoreSelfUseYear("GenerationProfitIgnoreSelfUseYear", "发电年收益（不计自发自用）"),
        GenerationProfitIgnoreSelfUseAmount("GenerationProfitIgnoreSelfUseAmount", "发电累计收益（不计自发自用）"),

        // 充电成本
        ChargeCost("ChargeCost", "充电成本"),
        ChargeCostDetail("ChargeCostDetail", "15min充电成本"),
        ChargeCostDay("ChargeCostDay", "日充电成本"),
        ChargeCostMonth("ChargeCostMonth", "月充电成本"),
        ChargeCostYear("ChargeCostYear", "年充电成本"),
        ChargeCostAmount("ChargeCostAmount", "累计充电成本"),

        // 放电收益
        DischargeProfit("DischargeProfit", "放电收益"),
        DischargeProfitDetail("DischargeProfitDetail", "15min放电收益"),
        DischargeProfitDay("DischargeProfitDay", "日放电收益"),
        DischargeProfitMonth("DischargeProfitMonth", "月放电收益"),
        DischargeProfitYear("DischargeProfitYear", "年放电收益"),
        DischargeProfitAmount("DischargeProfitAmount", "累计放电收益"),

        // 发电量
        Generation("Generation", "发电量"),
        GenerationDetail("GenerationDetail", "15min发电量"),
        GenerationDay("GenerationDay", "日发电量"),
        GenerationDayMeas("GenerationDayMeas", "日发电量（实际量测值）"),
        GenerationMonth("GenerationMonth", "月发电量"),
        GenerationYear("GenerationYear", "年发电量"),
        GenerationAmount("GenerationAmount", "累计发电量"),

        // 购电量
        EnergyBought("EnergyBought", "购电量"),
        EnergyBoughtDetail("EnergyBoughtDetail", "15min购电量"),
        EnergyBoughtDay("EnergyBoughtDay", "日购电量"),
        EnergyBoughtDayMeas("EnergyBoughtDayMeas", "日购电量（实际量测值）"),
        EnergyBoughtMonth("EnergyBoughtMonth", "月购电量"),
        EnergyBoughtYear("EnergyBoughtYear", "年购电量"),
        EnergyBoughtAmount("EnergyBoughtAmount", "累计购电量"),

        // 用电量
        EnergyConsumption("EnergyConsumption", "用电量"),
        EnergyConsumptionDetail("EnergyConsumptionDetail", "15min用电量"),
        EnergyConsumptionDay("EnergyConsumptionDay", "日用电量"),
        EnergyConsumptionDayMeas("EnergyConsumptionDayMeas", "日用电量（实际量测值）"),
        EnergyConsumptionMonth("EnergyConsumptionMonth", "月用电量"),
        EnergyConsumptionYear("EnergyConsumptionYear", "年用电量"),
        EnergyConsumptionAmount("EnergyConsumptionAmount", "累计用电量"),

        // 上网电量
        OngridEnergy("OngridEnergy", "上网电量"),
        OngridEnergyDetail("OngridEnergyDetail", "15min上网电量"),
        OngridEnergyDay("OngridEnergyDay", "日上网电量"),
        OngridEnergyDayMeas("OngridEnergyDayMeas", "日上网电量（实际量测值）"),
        OngridEnergyMonth("OngridEnergyMonth", "月上网电量"),
        OngridEnergyYear("OngridEnergyYear", "年上网电量"),
        OngridEnergyAmount("OngridEnergyAmount", "累计上网电量"),

        // 上网收益
        OngridProfit("OngridProfit", "上网收益"),
        OngridProfitDetail("OngridProfitDetail", "15min上网收益"),
        OngridProfitDay("OngridProfitDay", "日上网收益"),
        OngridProfitMonth("OngridProfitMonth", "月上网收益"),
        OngridProfitYear("OngridProfitYear", "年上网收益"),
        OngridProfitAmount("OngridProfitAmount", "累计上网收益"),

        // 自发自用电量
        SelfConsumptionEnergy("SelfConsumptionEnergy", "自发自用电量"),
        SelfConsumptionEnergyDetail("SelfConsumptionEnergyDetail", "15min自发自用电量"),
        SelfConsumptionEnergyDay("SelfConsumptionEnergyDay", "日自发自用电量"),
        SelfConsumptionEnergyMonth("SelfConsumptionEnergyMonth", "月自发自用电量"),
        SelfConsumptionEnergyYear("SelfConsumptionEnergyYear", "年自发自用电量"),
        SelfConsumptionEnergyAmount("SelfConsumptionEnergyAmount", "累计自发自用电量"),

        // 自发自用收益
        NongridProfit("NongridProfit", "自发自用收益"),
        NongridProfitDetail("NongridProfitDetail", "15min自发自用收益"),
        NongridProfitDay("NongridProfitDay", "日自发自用收益"),
        NongridProfitMonth("NongridProfitMonth", "月自发自用收益"),
        NongridProfitYear("NongridProfitYear", "年自发自用收益"),
        NongridProfitAmount("NongridProfitAmount", "累计自发自用收益"),

        LoadMeterIndication("LoadMeterIndication", "负载用电电表示数（自发自用电量）"),

        // CO2减排量
        CO2Reduction("CO2Reduction", "CO2减排量"),
        CO2ReductionDetail("CO2ReductionDetail", "15minCO2减排量"),
        CO2ReductionDay("CO2ReductionDay", "日CO2减排量"),
        CO2ReductionMonth("CO2ReductionMonth", "月CO2减排量"),
        CO2ReductionYear("CO2ReductionYear", "年CO2减排量"),
        CO2ReductionAmount("CO2ReductionAmount", "累计CO2减排量"),


        SaveStandardCoal("SaveStandardCoal", "节约标准煤"),
        SaveStandardCoalDetail("SaveStandardCoalDetail", "15min节约标准煤"),
        SaveStandardCoalDay("SaveStandardCoalDay", "日节约标准煤"),
        SaveStandardCoalMonth("SaveStandardCoalMonth", "月节约标准煤"),
        SaveStandardCoalYear("SaveStandardCoalYear", "年节约标准煤"),
        SaveStandardCoalAmount("SaveStandardCoalAmount", "累计节约标准煤"),

        TreePlant("TreePlant", "等效植树"),
        TreePlantDetail("TreePlantDetail", "15min等效植树"),
        TreePlantDay("TreePlantDay", "日等效植树"),
        TreePlantMonth("TreePlantMonth", "月等效植树"),
        TreePlantYear("TreePlantYear", "年等效植树"),
        TreePlantAmount("TreePlantAmount", "累计等效植树"),
        /**************** 电量和收益相关点号数据类型-结束 ****************/

        /**************** 电池相关点号数据类型-开始 ****************/
        SOC("SOC","SOC"),
        SOH("SOH","SOH"),
        HealthScore("HealthScore", "健康分"),
        VOLTAGE_EXTREMUM_SUB("VoltageExtremumSub", "电压极差值"),
        CELL_MAX_VOLTAGE("CellMaxVoltage", "单体最大电压"),
        CELL_MIN_VOLTAGE("CellMinVoltage", "单体最小电压"),
        CELL_AVG_VOLTAGE("CellAvgVoltage", "单体平均电压"),
        CELL_VOLTAGE_RANGE("CellVoltageRange", "单体电压极差"),
        MAX_VOLTAGE_SERIAL("MaxVoltageSerial", "最大电压电池号"),
        MIN_VOLTAGE_SERIAL("MinVoltageSerial", "最小电压电池号"),
        TEMPERATURE_EXTREMUM_SUB("TemperatureExtremumSub", "温度极差值"),
        CELL_MAX_TEMPERATURE("CellMaxTemp", "单体最大温度"),
        CELL_MIN_TEMPERATURE("CellMinTemp", "单体最小温度"),
        CELL_AVG_TEMPERATURE("CellAvgTemp", "单体平均温度"),
        CELL_TEMPERATURE_RANGE("CellTempRange", "单体温度极差"),
        MAX_CELL_TEMPERATURE_RANGE("MaxCellTempRange", "最大单体温度极差"),
        MAX_TEMPERATURE_SERIAL("MaxTemperatureSerial", "最大温度电池号"),
        MIN_TEMPERATURE_SERIAL("MinTemperatureSerial", "最小温度电池号"),
        CELL_MAX_SOC("CellMaxSOC", "单体最大SOC"),
        CELL_MIN_SOC("CellMinSOC", "单体最小SOC"),
        SOC_RANGE("SOCRange", "SOC极差值"),
        RemainingChargeTime("RemainingChargeTime", "充电剩余时间"),
        RemainingDischargeTime("RemainingDischargeTime", "放电剩余时间"),
        /**************** 电池相关点号数据类型-结束 ****************/

        /**************** 光伏相关点号数据类型-结束 ****************/
        // 辐照
        IRRADIANCE("Irradiance", "辐照"),
        IRRADIANCE_DETAIL("IrradianceDetail", "日内累计辐照"),
        IrradianceCurrentDay("IrradianceDayCurrent", "当日累计辐照"),
        IrradianceCurrentMonth("IrradianceMonthCurrent", "当月累计辐照"),
        IrradianceCurrentYear("IrradianceYearCurrent", "当年累计辐照"),
        IrradianceCurrentAmount("IrradianceAmountCurrent", "总累计辐照"),

        // 理论发电量
        THEORETICAL_GENERATION("TheoreticalGeneration", "日内理论发电量"),
        THEORETICAL_GENERATION_DETAIL("TheoreticalGenerationDetail", "15min理论发电量"),
        THEORETICAL_GENERATION_DAY("TheoreticalGenerationDayCurrent", "日理论发电量"),
        THEORETICAL_GENERATION_MONTH("TheoreticalGenerationMonthCurrent", "月理论发电量"),
        THEORETICAL_GENERATION_YEAR("TheoreticalGenerationYearCurrent", "年理论发电量"),
        THEORETICAL_GENERATION_AMOUNT("TheoreticalGenerationAmountCurrent", "累计理论发电量"),

        // LGC收益
        LgcProfitMonth("LgcProfitMonth", "月LGC收益"),
        LgcProfitYear("LgcProfitYear", "年LGC收益"),
        LgcProfitAmount("LgcProfitAmount", "累计LGC收益"),
        LgcPrice("LgcPrice", "LGC单价"),

        // 满发时长
        YIELD_DAY("YieldDayCurrent", "日满发时长"),
        YIELD_MONTH("YieldMonthCurrent", "月满发时长"),
        YIELD_YEAR("YieldYearCurrent", "年满发时长"),
        YIELD_AMOUNT("YieldAmountCurrent", "累计满发时长"),

        // 离散率
        DIVERGENCE("Divergence", "离散率"),
        DIV_TIPS("DivTips", "离散率提示"),
        DIV_WARN("DivWarn", "离散率警告"),
        DIV_FAULT("DivFault", "离散率故障"),

        // 效率
        PERFORMANCE_RATIO_DAY("PrDayCurrent", "日系统效率"),
        PERFORMANCE_RATIO_MONTH("PrMonthCurrent", "月系统效率"),
        PERFORMANCE_RATIO_YEAR("PrYearCurrent", "年系统效率"),
        PERFORMANCE_RATIO_AMOUNT("PrAmountCurrent", "累计系统效率"),

        // 效率
        DAY_EFFICIENCY("DayEfficiency", "日效率"),
        MONTH_EFFICIENCY("MonthEfficiency", "月效率"),
        YEAR_EFFICIENCY("YearEfficiency", "年效率"),
        AMOUNT_EFFICIENCY("AmountEfficiency", "总效率"),

        // 预测
        DAY_AHEAD_FORECAST("DayAheadForecast", "日前预测"),
        INTRADAY_FORECAST("IntradayForecast", "日内预测"),
        /**************** 光伏相关点号数据类型-结束 ****************/

        /**************** 其他点号数据类型 ****************/
        LeakageCurrent("LeakageCurrent", "漏电流"),
        GenerationAmountMeas("GenerationAmountMeas", "累计发电量"),
        TotalGenerationHours("TotalGenerationHours", "累计发电小时"),
        PowerLimitPercentage("PowerLimitPercentage", "功率限制百分比"),
        TotalRunHours("TotalRunHours", "累计运行小时"),
        LoadCurrent("LoadCurrent", "用电电流"),
        LoadActivePower("LoadActivePower", "用电总功率"),
        LoadReactivePower("LoadReactivePower", "用电总无功功率"),
        LoadVoltage("LoadVoltage", "用电电压"),
        GridActivePower("GridActivePower", "电网总功率"),
        GridReactivePower("GridReactivePower", "电网总无功功率"),
        OngridEnergyAmountMeas("OngridEnergyAmountMeas", "累计并网量"),
        GridStatus("GridStatus", "电网状态"),
        EnergyConsumptionAmountMeas("EnergyConsumptionAmountMeas", "累计用电量"),
        ControlCommand("ControlCommand", "控制指令"),
        UsedRecycleTimes("UsedRecycleTimes", "已用循环次数"),

        //充放电记录
        OCV("OCV", "OCV"),

        // 电池日效率
        BatteryEfficiencyDay("BatteryEfficiencyDay", "电池日效率"),

        // 效率计算用充放电量
        BMSChargeDay("BMSChargeDay", "BMS侧的日充电量"),
        PCSChargeDay("PCSChargeDay", "PCS侧的日充电量"),
        BMSDischargeDay("BMSDischargeDay", "BMS侧的日放电量"),
        PCSDischargeDay("PCSDischargeDay", "PCS侧的日放电量"),
        GridChargeDay("GridChargeDay", "并网侧日充电量"),
        GridDischargeDay("GridDischargeDay", "并网侧日放电量"),

        BMSChargeAmount("BMSChargeAmount", "BMS侧的累计充电量"),
        PCSChargeAmount("PCSChargeAmount", "PCS侧的累计充电量"),
        BMSDischargeAmount("BMSDischargeAmount", "BMS侧的累计放电量"),
        PCSDischargeAmount("PCSDischargeAmount", "PCS侧的累计放电量"),
        GridChargeAmount("GridChargeAmount", "并网侧累计充电量"),
        GridDischargeAmount("GridDischargeAmount", "并网侧累计放电量"),

        StackVoltage("StackVoltage", "堆电压"),
        StackCurrent("StackCurrent", "堆电流");

        private String value;
        private String title;
        POINT_DATA_TYPE(String value, String title) {
            this.value = value;
            this.title = title;
        }
        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
        public boolean equals(String value) {
            return this.value().equals(value);
        }
        public static POINT_DATA_TYPE byValue(String value) {
            POINT_DATA_TYPE[] values = POINT_DATA_TYPE.values();
            for (POINT_DATA_TYPE item : values) {
                if (item.equals(value)) {
                    return item;
                }
            }
            return null;
        }
    }

    public enum ATTRIBUTE_TYPE {

        INTEGER("Integer", "整数"),
        FLOAT("Float", "浮点数"),
        INTEGER_RANGE("Integer Range", "整数区间"),
        FLOAT_RANGE("Float Range", "浮点数区间"),
        STRING("String", "字符串"),
        ENUM("Enum", "枚举"),
        SystemEnum("systemEnum", "系统枚举");

        private String value;
        private String title;

        ATTRIBUTE_TYPE(String value, String title) {
            this.value = value;
            this.title = title;
        }

        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
    }

    public enum ENERGY_UNIT_TYPE {

        Storage("Storage", "储能"),
        Solar("Solar", "光伏"),
        WindPower("WindPower", "风电"),
        Generation("Generation", "发电"),
        Load("Load", "用能"),
        PowerGrid("PowerGrid", "电网"),
        //并网单元是一种特殊的设备单元，不属于能量单元或者用能单元或者发电单元，其与能量单元平级，不可编辑/删除，不可再次添加
        GridConnectedUnit("GridConnectedUnit", "并网单元"),
        AccessoryDevice("AccessoryDevice", "附属设备");

        private String value;
        private String title;

        ENERGY_UNIT_TYPE(String value, String title) {
            this.value = value;
            this.title = title;
        }

        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
        public boolean equals(String value) {
            return this.value().equals(value);
        }
        public static ENERGY_UNIT_TYPE byValue(String value) {
            ENERGY_UNIT_TYPE[] values = ENERGY_UNIT_TYPE.values();
            for (ENERGY_UNIT_TYPE item : values) {
                if (item.equals(value)) {
                    return item;
                }
            }
            return null;
        }
    }

    public enum ENERGY_UNIT_RUNSTATUS {

        Charge("Charge", "充电"),
        Discharge("Discharge", "放电"),
        Storage("Storage", "蓄电"),
        OffGrid("OffGrid", "离网"),
        Fault("Fault", "故障"),
        Debug("Debug", "调试");

        private String value;
        private String title;

        ENERGY_UNIT_RUNSTATUS(String value, String title) {
            this.value = value;
            this.title = title;
        }

        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
    }

    public enum SOLAR_ENERGY_UNIT_RUNSTATUS {

        RUN("Run", "运行"),
        OffGrid("OffGrid", "离网"),
        Fault("Fault", "故障");

        private String value;
        private String title;

        SOLAR_ENERGY_UNIT_RUNSTATUS(String value, String title) {
            this.value = value;
            this.title = title;
        }

        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
    }

    /**
     * 模型属性分类标志.
     */
    public enum MODEL_ATTRIBUTE_TYPE {

        StationDefault(1, "电站默认属性"),
        EnergyUnitDefault(2, "能量单元默认属性"),
        DeviceDefault(3, "设备默认属性"),
        Other(4,"其他自定义属性");
        private int value;
        private String title;

        MODEL_ATTRIBUTE_TYPE(int value, String title) {
            this.value = value;
            this.title = title;
        }

        public int value() {
            return value;
        }
        public String title() {
            return title;
        }
    }

    /*
     * 设备大类枚举
     */
    public enum DEVICE_CATEGORY {

        Transformer("Transformer", "变压器"),
        Converter_Inverter("ConverterInverter", "变流器/逆变器"),
        Breaker("Breaker", "开关"),
        GenerationDevice("GenerationDevice", "发电机（组）"),
        LithiumIonBattery("LithiumIonBattery", "锂离子电池"),
        LeadCarbonBattery("LeadCarbonBattery", "铅炭电池"),
        SodiumSulfurBattery("SodiumSulfurBattery", "钠硫电池"),
        LiquidFlowBattery("LiquidFlowBattery", "液流电池"),
        DeviceContainer("DeviceContainer", "设备容器");

        private String value;
        private String title;

        DEVICE_CATEGORY(String value, String title) {
            this.value = value;
            this.title = title;
        }

        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
        public boolean equals(String value) {
            return this.value().equals(value);
        }
    }

    /**
     * 设备性质枚举
     */
    public enum DEVICE_PROPERTY {

        ElectricalDevice("ElectricalDevice", "电气设备"),
        GenerationDevice("GenerationDevice", "发电设备"),
        StorageDevice("StorageDevice", "储能设备"),
        Container_Device("ContainerDevice", "容器/设备"),
        LoadDevice("LoadDevice", "用电设备");

        private String value;
        private String title;

        DEVICE_PROPERTY(String value, String title) {
            this.value = value;
            this.title = title;
        }

        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
    }

    public enum TERMINAL_CONSTANTS {

        Default("default", "默认"),
        Input("Input", "输入"),
        Output("Output", "输出");

        private String value;
        private String title;

        TERMINAL_CONSTANTS(String value, String title) {
            this.value = value;
            this.title = title;
        }

        public String value() {
            return value;
        }
        public String title() {
            return title;
        }
    }

    /**
     * 根据点号获得电站代码
     * @param pointNumber 点号
     */
    public static Long getStationCode(Long pointNumber) {
        if (pointNumber >= 10000) {
            String point = String.valueOf(pointNumber);
            String code = point.substring(0, 4);
            if (OPTICAL_STORAGE_PREFIX.equals(code)) {
                if (point.length() >= 8) {
                    code = point.substring(0, 8);
                }
            }
            return Long.parseLong(code);
        }
        return null;
    }

    public enum EnergyUnitStatus {
        Activate("activate", "已投产"),
        Constructing("constructing", "建设中"),
        Testing("testing", "试运行"),
        Deactivated("deactivated", "已停运");

        private String value;
        private String title;

        EnergyUnitStatus(String value, String title) {
            this.value = value;
            this.title = title;
        }

        public String value() {
            return value;
        }

        public String title() {
            return title;
        }
    }
}
